在託管 Squid 服務的伺服器上配置 Samba

要配置 Samba 服務:

  1. 啟動 Samba 服務並將其新增到自動啟動。為此,請根據所使用的作業系統執行以下指令:
    • CentOS, Red Hat Enterprise Linux 或 SUSE Linux Enterprise Server:

      systemctl start smb

      systemctl enable smb

      systemctl start nmb

      systemctl enable nmb

    • Ubuntu 或 Debian:

      systemctl start smbd

      systemctl enable smbd

      systemctl start nmbd

      systemctl enable nmbd

  2. 新增以下參數到 /etc/samba/smb.conf 檔案:

    [全域]

    workgroup = <Active Directory 網域的 NetBIOS 名稱>

    password server = <Active Directory 網域控制器的 DNS 名稱>

    realm = <大寫的 Active Directory 網域名稱>

    security = ads

    idmap uid = 10000-20000

    idmap gid = 10000-20000

    winbind use default domain = no

    winbind request timeout = 300

  3. 將託管 Squid 服務的伺服器新增到 Active Directory 網域。為此,請執行指令:

    net ads join -U <domain administrator>

    您將被提示輸入網域管理員的密碼或有網域管理員權限的使用者的密碼。

  4. 請輸入管理員密碼然後按 ENTER 鍵。

    託管 Squid 服務的伺服器應該被新增到 Active Directory 網域。

  5. 請確保託管 Squid 服務的伺服器確實新增到了 Active Directory 網域。為此,請執行指令:

    net ads testjoin

    如果託管 Squid 服務的伺服器已被新增到 Active Directory 網域,主控台中會顯示 Join is OK

  6. 重啟 Samba 服務。為此,請根據所使用的作業系統執行以下指令:
    • CentOS, Red Hat Enterprise Linux 或 SUSE Linux Enterprise Server。

      systemctl restart smb

      systemctl restart nmb

    • Ubuntu 或 Debian。

      systemctl restart smbd

      systemctl restart nmbd

    如果您看到 "ERROR: failed to setup guest info", 您必須配置訪客群組的映射。為此,請執行命令 net groupmap add sid=S-1-5-32-546 unixgroup=nobody type=builtin

  7. 啟動 winbind 服務。為此,請執行指令:

    systemctl start winbind

  8. 新增 winbind 服務進行自動啟動。為此,請執行指令:

    systemctl enable winbind

  9. 如果使用 Ubuntu or Debian,請將 ‘代理’ 使用者新增到 'winbindd_priv' 群組。為此,請執行指令:

    usermod -a -G winbindd_priv proxy

Samba 配置將完成。繼續檢查 Samba 設定。

頁面頂端